<script></script>

<template>
    <div>
        <div class="dv1">
            <span class="sp1">未完成</span>
            <span class="num">{{ wei.length }}</span>
        </div>
        <ul>
            <li class="list" v-for="item in wei" :key="item.id">
                <div class="dv2">
                    <input type="checkbox" :checked="item.checked" @click="toogle(item.id)" />
                    <span class="text">{{ item.text }}</span>
                </div>
                <span class="del" @click="del(item.id)">删除</span>
            </li>
        </ul>
        <div class="dv1">
            <span class="sp1">已完成</span>
            <span class="num">{{ yi.length }}</span>
        </div>
        <ul>
            <li class="list" v-for="item in yi" :key="item.id">
                <div class="dv2">
                    <input type="checkbox" :checked="item.checked" @click="toogle(item.id)" />
                    <span class="text">{{ item.text }}</span>
                </div>
                <span class="del" @click="del(item.id)">删除</span>
            </li>
        </ul>
    </div>
</template>

<style scoped>
li {
    list-style: none;
}

* {
    margin: 0;
    padding: 0;
}

.dv1 {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
}

.todolist-box {
    width: 500px;
    border: 1px solid #ccc;
    margin: 0 auto;
}

.list {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dv2 {
    width: 100px;
    display: flex;
    align-items: center;
    margin-left: 5px;
}

.del {
    margin-right: 5px;
}

li {
    height: 35px;
}

.num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: black;
    color: #fff;
    font-size: 14px;
    text-align: center;
    line-height: 20px;
    margin-right: 5px;
}

.sp1 {
    margin-left: 5px;
}

.text {
    margin-left: 10px;
}
</style>
